import { createRouter, createWebHashHistory,NavigationGuardNext, RouteLocationNormalized } from "vue-router"

//通过VNode把loading加载到窗体

const router = createRouter({
    history: createWebHashHistory(),

    //滚动行为
    /** 
    scrollBehavior: (to, from, savePosition) => {
        
    }
    */
    routes: [
        {
            path: "/",
            component: () => import('@renderer/components/Home.vue'),
            redirect:"/strategy",
            children: [{
                path: "/order",
                name: "order",
                component:()=>import('@renderer/components/OrderPan.vue')
            },
            {
                path: "/strategy",
                name: "strategy",
                component:()=>import("@renderer/components/StrategyPan.vue")
            }
            ]
        },
        {
            path:"/call/add",component:()=>import('@renderer/views/strategy/call/AddStrategy.vue')
        }
    ]

})

router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => {
    // useLoginProcedure().checkLogin(to, from).then(res=>{
    //     if(true===res) next()
    //     else next(res)
        next()
    })

router.afterEach((to, from) => {
    
})

export default router